"""Django_01 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin

import booktest
import user
from user import views

urlpatterns = [
    #Django自带后台管理模块
    #URL（）第一个参数是正则匹配规则，第二个参数是匹配成功后执行的视图函数
    url(r'^admin/', admin.site.urls),
    # url(r'^', include("user.urls")),
    #只要网址中的字符串包含正则表达式中的就能匹配上，eg:xxxuser/indexxxx,也可匹配上
    #所以要加开头^和结尾$
    url(r'^user/', include("user.urls",namespace="user_room")),
    url(r'^news/(?P<height>\d+)/(?P<age>\d+)',user.views.news),

    url(r'^set_cookie/$',user.views.set_cookie),
    url(r'^get_cookie/$',user.views.get_cookie),
    url(r'^set_session/$',user.views.set_session),
    url(r'^get_session/$',user.views.get_session),
    # url(r'^', include('booktest.urls--API自定义接口'))
    url(r'^', include('booktest.urls')),

]
